{template 'common/header'}
<form action="" method="post" class="form form-horizontal">
<div class="panel panel-default">
	<div class="panel-heading">关键字分组设置</div>
	<div class="panel-body">
		<div id='model' style="display: none;">
	       	<div class="form-group">
	         	<label class="col-xs-12 col-sm-3 col-md-2 control-label">关键字分组</label>
	         	<div class="col-sm-9">
	             	<div class='input-group'>
			        	<div class='input-group-addon'>关键字：</div>     	
	             		<input class='form-control' name='kword[]' placeholder="请输入关键字">
	             		<div class='input-group-addon'>分组：</div>
	             		<select class='form-control' name='gid[]'>
	             				<option value='0'>请选择分组</option>
	             			{loop $fgroups $g}
	                         	<option value="{$g['id']}">{$g['name']}</option>
	                        {/loop}
	             		</select>
	             		<div class='input-group-addon'>回复文字：</div>
	             		<input class='form-control' name='tips[]' placeholder="请输入回复文字">
	             	</div>
	         	</div>
	       	</div>
	     </div>
	     {loop $set $s}
		  <div class="form-group">
	         	<label class="col-xs-12 col-sm-3 col-md-2 control-label">关键字分组</label>
	         	<div class="col-sm-9">
	             	<div class='input-group'>
			        	<div class='input-group-addon'>关键字：</div>     	
	             		<input class='form-control' name='kword[]' placeholder="请输入关键字" value="{$s['kword']}">
	             		<div class='input-group-addon'>分组：</div>
	             		<select class='form-control' name='gid[]'>
	             				<option value='0'>请选择分组</option>
	             			{loop $fgroups $g}
	                         	<option value="{$g['id']}" {if $s['fgid']==$g['id']}selected{/if}>{$g['name']}</option>
	                        {/loop}
	             		</select>
	             		<div class='input-group-addon'>回复文字：</div>
	             		<input class='form-control' name='tips[]' placeholder="请输入回复文字" value="{$s['tips']}">
	             	</div>
	         	</div>
	       	</div>	     
	     {/loop}
	     <div class="form-group">
			<label class="col-xs-12 col-sm-3 col-md-2 control-label"></label>
  			<div class="col-sm-9">
  				<a class="btn btn-warning" onclick="onAdd(this)">添加关键字分组</a>
  				<div class="help-block">关键字文字为空或者分组没选择，即删除；请保证关键字不重复</div>
  			</div>
		</div>
	</div>
</div>
<button class="btn btn-primary" type="submit" name="submit" value="提交">提交</button>
<input type="hidden" name="token" value="{$_W['token']}">
</form>
<script>
function onAdd(obj){
	$(obj).parent().parent().before($('#model').html());
}
</script>
{template 'common/footer'}